chore: remove unused imports and dead ui plumbing - #50
Merged
Conversation
tsconfig sets noUnusedLocals and noUnusedParameters to false and verify.ts
has no rule for unused imports, so nothing in the gate ever complains about
dead code. Running tsc with both flags as a one-off probe surfaced ~70 hits;
this removes the ones that are genuinely dead rather than the parameters that
exist for interface conformance.
The load-bearing ones: runtime/loop.ts imported classifyCommand, commandOf
and toolEffect and read none of them; two tools imported the TUI store they
never touch, which is also the wrong direction architecturally.
useBootAnimation carried a logoText state whose setter was never called, so
it was permanently the empty string while BootScreen hardcoded the word it
actually renders. HomeScreenData.provider existed only to hold the result of
a getModelDisplayName() call that nothing rendered — app.tsx already derives
the model name from the store — and removing it lets buildHomeScreen drop a
parameter. isThinking was threaded from app.tsx through ConversationViewport
into Timeline and read at none of them; the store field and the tests that
assert on it are untouched, only the render plumbing is gone.
Comments were left alone except for three cases that document nothing: an
eslint-disable directive in a repo with no ESLint config, and restatement-only
JSDoc in config/paths.ts ("Get the path to models.json"). The long "why"
comments throughout providers/ and runtime/ are documentation and stay.
One trap worth recording: getConfigDir() is not a pure getter, it mkdirSyncs
the directory. Dropping the unused configDir local in initializeConfig() is
only safe because the next line calls getProvidersConfigPath(), which calls
getConfigDir() again.
Two dead props were found and deliberately left: CommandPreview.query and
Prompt.providerName are declared and passed by callers but never read.
Removing them means editing prop interfaces plus call sites, which is a wider
change than this one is scoped to.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
tsconfig.jsonsetsnoUnusedLocalsandnoUnusedParameterstofalse, andverify.tshas no rule for unused imports. Nothing in the gate has evercomplained about dead code, so it accumulated quietly.
Running
tsc --noEmit --noUnusedLocals --noUnusedParametersas a one-off probesurfaced ~70 hits. Most are parameters that exist for interface conformance and
should stay. This PR removes the minority that are genuinely dead — including
startup work that looks like it feeds the UI and does not.
What
runtime/loop.ts— the wholetoolEffectsimportclassifyCommand,commandOfandtoolEffectall imported, none read.turnState.ts,planMode.tsandexecutionLog.tsgenuinely use them and are untouched.tools/runTests.ts,tools/terminal.ts— the UI store importuseBootAnimation—LOGO,logoTextstatesetLogoTextwas never called, sologoTextwas permanently"".BootScreendestructured it and hardcodes the word it actually renders.HomeScreenData.repository,.provider.providerexisted only to hold agetModelDisplayName()result that was discarded;app.tsxalready derives the model name from the store. Dropping it letsbuildHomeScreen()shed a parameter.isThinkingrender chain (6 sites)app.tsxthroughConversationViewportintoTimelineand read at none of them.ReactNode,Text,colors,React,chalk, 8 test importseslint-disabledirective in a repo with no ESLint config, and restatement-only JSDoc inconfig/paths.ts(/** Get the path to models.json */).UIState.isThinkingand the store logic that maintains it stay —ui-store.test.tsasserts on them. Only the rendering plumbing is gone.The long "why" comments throughout
providers/andruntime/are documentation,not noise, and were deliberately left alone. So were the
// ─── … ───sectionbanners.
One trap worth recording
getConfigDir()is not a pure getter — itmkdirSyncs the directory. Droppingthe unused
configDirlocal ininitializeConfig()is only safe because thenext line calls
getProvidersConfigPath(), which callsgetConfigDir()again.Deliberately left in
Two more dead props turned up:
CommandPreview.queryandPrompt.providerNameare declared and actively passed by callers, but never read. Removing them means
editing prop interfaces plus every call site — a wider change than this one is
scoped to, so they are left for a follow-up.
Also left:
TurnFooter.endedAtlooked dead in the probe but is load-bearing(
TurnFooter.tsx:67,72). Only a redundant re-destructure insideTurnFooterRowwas removed.
Verified
Baseline captured on the clean tree before any edit, so there is something to
compare against:
After the change:
Same test count as the baseline. The
expect()call total does drift betweenruns (18194 and 18176 on an identical tree) — that is fast-check's random
seeding, confirmed by running the suite twice without changes, not a regression.
Re-running the probe that found all this leaves only the intentional callback
parameters and the two props noted above — no import or module-level binding
remains flagged.
Not run:
bun run start. The boot animation and home screen changes aretype-checked and covered by the existing TUI render tests, but nobody has
watched the app boot with these edits in place. Worth a look before this leaves
draft.
🤖 Generated with Claude Code